package com.dao.qsl;

import com.bean.qsl.HdInfo;
import com.util.qsl.Dbutil;
import org.springframework.stereotype.Repository;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

@Repository
public class HdXx {

      public  List<HdInfo> hd(){
	  Dbutil d=new Dbutil();
	  Connection c=null;

	  List<HdInfo> list=new ArrayList<>();
	  try {
	         c=d.getConnection();
	         String  sql="SELECT * from village v,community c where v.vid=c.vid";
	         PreparedStatement pr=c.prepareStatement(sql);

	         ResultSet rs=pr.executeQuery();

	         while (rs.next()){
		     HdInfo h=new HdInfo();
		     h.setHdxh(rs.getInt("cid"));
		     h.setHdmc(rs.getString("cname"));
		     h.setKsj(rs.getString("startDate"));
		     h.setJssj(rs.getString("endDate"));
		     h.setZt(rs.getString("zt"));
		     h.setXqmc(rs.getString("vname"));
		     list.add(h);
	         }
	  }catch (Exception e){
	        e.printStackTrace();
	  }
	  return list;
      }
}
